package com.piesat.quake.business.device.mqtt.param;

import com.piesat.quake.business.device.mqtt.DataType;

import java.lang.reflect.Field;

public class CharParseParam extends ParseParam {
    private Integer length;

    public CharParseParam() {
    }

    public CharParseParam(Integer length) {
        this.length = length;
    }

    public CharParseParam(Field field, Integer type, Integer length) {
        super(field, type);
        this.length = length;
    }

    public static CharParseParam create(Field field, Integer length) {
        return new CharParseParam(field, DataType.CHAR.ordinal(), length);
    }

    public int getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    @Override
    public String toString() {
        return "CharParseParam{" +
                "length=" + length +
                ", field='" + field + '\'' +
                ", type=" + type +
                '}';
    }
}